<?php
session_start() ;
if(!isset($_SESSION["login"]) || $_SESSION["login"] == "")
{   
  header("Location: index.php?error=4") ;
}?>

<html>
<head>
<title>Administration</title>
 <link rel="stylesheet" type="text/css" href="style.css" >  
</head>

<body>
<?php require("menu.php");
require("fonctions.php");
$code=$_GET["error"];
?>
<p class="titre">Fiche de synth&egrave;se des d&eacute;cisions RT</p>

<table>
<tr>
	<td class="tab_dis_head" colspan=3>Liste de d&eacute;cision en attente de validation RT de la vague en cours</td>
</tr>
</table>
<table class="tab_dis">
<tr>
	
	<td class="tab_dis_head">ETABLISSEMENT</td>
	
	<td class="tab_dis_head">Numero interview</td>
	<td class="tab_dis_head"></td>
</tr>
<?php 
	$sql="select distinct(id_interv),distributeur from data_temp 
		join vagues_camp on descrip = vague
		where decision in('',0) and arg_res<>''
		and vagues_camp.statut='EN_COURS'
		order by id_interv";
	//echo $sql;
	$res = mysql_query($sql) or die("pb : $sql");
	while($r = mysql_fetch_object($res)){
?>
<tr>
	<td class="tab_dis_data"><?php echo $r->distributeur;?></td>

	<td class="tab_dis_data"><?php echo $r->id_interv;?></td>
	
</tr>

<?php  }?>
</table>
 
<p class="titre">Exporter les donn&eacute;es sous Excel </p>

<table>
<tr>
	<td><a href="Fiches_synthese_par_reparateur.xls">T&eacute;l&eacute;charger la fiche de synth&egrave;se</a></td>
</tr>
</table>
<p class="titre">R&eacute;capitulatif du nombre de connexions au site par distributeur </p>

<table class="tab_dis">
<tr>
<td class="tab_dis_head">ID_USER</td>
<td class="tab_dis_head">PROFIL</td>
<td class="tab_dis_head">ETABLISSEMENT</td>
<td class="tab_dis_head">NBRE DE CONNEXIONS</td>
<td class="tab_dis_head">DATE</td>

</tr>
<?php $sql="select count(id_user) as nombre,id_user,profil,max(date_con) as v_date from histo_con 
				group by profil,id_user
				order by id desc";
//echo $sql;
	 $res =mysql_query($sql) or die("pb : $sql");;
	while($r=mysql_fetch_object($res)){
?>
<tr><td class="tab_dis_data"><?php echo $r->id_user?></td>
<td class="tab_dis_data"><?php echo $r->profil?></td>
<td class="tab_dis_data" ><?php if($r->profil=="DIS") echo $val = getDistribName($r->id_user)?></td>
<td class="tab_dis_data" align=center><?php echo $r->nombre?></td>
<td class="tab_dis_data"><?php echo $r->v_date?></td></tr>
<?php }?>
</table>
</body>

</html>
